﻿<Activity mc:Ignorable="sap sap2010 sads" x:Class="Artezio.SP.WorkflowActions.GetRoleDefinitionId"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:p="http://schemas.microsoft.com/workflow/2012/07/xaml/activities"
 xmlns:p1="wf://workflow.windows.net/$Activities"
 xmlns:s="clr-namespace:System;assembly=mscorlib"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:sn="clr-namespace:System.Net;assembly=System"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="WebUrl" Type="InArgument(x:String)" />
    <x:Property Name="RoleDefinitionId" Type="OutArgument(x:Int32)">
      <x:Property.Attributes>
        <RequiredArgumentAttribute />
      </x:Property.Attributes>
    </x:Property>
    <x:Property Name="RoleName" Type="InArgument(x:String)">
      <x:Property.Attributes>
        <RequiredArgumentAttribute />
      </x:Property.Attributes>
    </x:Property>
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>Artezio.SP.WorkflowActions.GetRoleDefinitionId_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Text</x:String>
      <x:String>Microsoft.Activities</x:String>
      <x:String>System.Net</x:String>
      <x:String>System.Activities</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.SharePoint.DesignTime.Activities</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>Microsoft.Activities.Design</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>Artezio.SP.WorkflowActions</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence DisplayName="GetRoleDefinitionId" sap2010:WorkflowViewState.IdRef="Sequence_1">
    <Sequence.Variables>
      <Variable x:TypeArguments="p:DynamicValue" Name="response" />
      <Variable x:TypeArguments="sn:HttpStatusCode" Name="code" />
      <Variable x:TypeArguments="x:String" Name="errorMessage" />
    </Sequence.Variables>
    <If sap2010:WorkflowViewState.IdRef="If_1">
      <If.Condition>
        <InArgument x:TypeArguments="x:Boolean">
          <mca:CSharpValue x:TypeArguments="x:Boolean">string.IsNullOrWhiteSpace(WebUrl)</mca:CSharpValue>
        </InArgument>
      </If.Condition>
      <If.Then>
        <Sequence sap2010:WorkflowViewState.IdRef="Sequence_2">
          <p1:AppOnlySequence DisplayName="Write to history">
            <p1:AppOnlySequence.Body>
              <p1:WriteToHistory sap2010:WorkflowViewState.IdRef="WriteToHistory_1" Message="GetRoleDefinitionId: WebUrl is empty" />
            </p1:AppOnlySequence.Body>
            <sap2010:WorkflowViewState.IdRef>AppOnlySequence_2</sap2010:WorkflowViewState.IdRef>
          </p1:AppOnlySequence>
          <p1:WebUri sap2010:WorkflowViewState.IdRef="WebUri_1">
            <p1:WebUri.Result>
              <OutArgument x:TypeArguments="x:String">
                <mca:CSharpReference x:TypeArguments="x:String">WebUrl</mca:CSharpReference>
              </OutArgument>
            </p1:WebUri.Result>
          </p1:WebUri>
          <p1:AppOnlySequence DisplayName="Write to history">
            <p1:AppOnlySequence.Body>
              <p1:WriteToHistory sap2010:WorkflowViewState.IdRef="WriteToHistory_2">
                <p1:WriteToHistory.Message>
                  <InArgument x:TypeArguments="x:String">
                    <mca:CSharpValue x:TypeArguments="x:String">"GetRoleDefinitionId: WebUrl property is set to: " + WebUrl</mca:CSharpValue>
                  </InArgument>
                </p1:WriteToHistory.Message>
              </p1:WriteToHistory>
            </p1:AppOnlySequence.Body>
            <sap2010:WorkflowViewState.IdRef>AppOnlySequence_3</sap2010:WorkflowViewState.IdRef>
          </p1:AppOnlySequence>
        </Sequence>
      </If.Then>
    </If>
    <Sequence DisplayName="GetRoleDefinition Logic" sap2010:WorkflowViewState.IdRef="Sequence_3">
      <p1:AppOnlySequence sap2010:WorkflowViewState.IdRef="AppOnlySequence_1">
        <p1:AppOnlySequence.Body>
          <p:HttpSend sap2010:WorkflowViewState.IdRef="HttpSend_1" Method="GET">
            <p:HttpSend.RequestHeaders>
              <InArgument x:TypeArguments="p:DynamicValue">
                <p:SetDynamicValueProperties>
                  <scg:Dictionary x:TypeArguments="x:String, InArgument">
                    <InArgument x:TypeArguments="x:String" x:Key="Accept">application/json; odata=verbose</InArgument>
                    <InArgument x:TypeArguments="x:String" x:Key="Content-Type">application/json; odata=verbose</InArgument>
                  </scg:Dictionary>
                </p:SetDynamicValueProperties>
              </InArgument>
            </p:HttpSend.RequestHeaders>
            <p:HttpSend.ResponseContent>
              <OutArgument x:TypeArguments="p:DynamicValue">
                <mca:CSharpReference x:TypeArguments="p:DynamicValue">response</mca:CSharpReference>
              </OutArgument>
            </p:HttpSend.ResponseContent>
            <p:HttpSend.ResponseStatusCode>
              <OutArgument x:TypeArguments="sn:HttpStatusCode">
                <mca:CSharpReference x:TypeArguments="sn:HttpStatusCode">code</mca:CSharpReference>
              </OutArgument>
            </p:HttpSend.ResponseStatusCode>
            <p:HttpSend.Uri>
              <InArgument x:TypeArguments="x:String">
                <mca:CSharpValue x:TypeArguments="x:String">WebUrl + string.Format("_api/web/RoleDefinitions/GetByName('{0}')", RoleName)</mca:CSharpValue>
              </InArgument>
            </p:HttpSend.Uri>
          </p:HttpSend>
        </p1:AppOnlySequence.Body>
      </p1:AppOnlySequence>
      <If sap2010:WorkflowViewState.IdRef="If_2">
        <If.Condition>
          <InArgument x:TypeArguments="x:Boolean">
            <mca:CSharpValue x:TypeArguments="x:Boolean">code == HttpStatusCode.OK</mca:CSharpValue>
          </InArgument>
        </If.Condition>
        <If.Then>
          <p:GetDynamicValueProperty x:TypeArguments="x:Int32" sap2010:WorkflowViewState.IdRef="GetDynamicValueProperty`1_2" PropertyName="d/Id">
            <p:GetDynamicValueProperty.Result>
              <OutArgument x:TypeArguments="x:Int32">
                <mca:CSharpReference x:TypeArguments="x:Int32">RoleDefinitionId</mca:CSharpReference>
              </OutArgument>
            </p:GetDynamicValueProperty.Result>
            <p:GetDynamicValueProperty.Source>
              <InArgument x:TypeArguments="p:DynamicValue">
                <mca:CSharpValue x:TypeArguments="p:DynamicValue">response</mca:CSharpValue>
              </InArgument>
            </p:GetDynamicValueProperty.Source>
          </p:GetDynamicValueProperty>
        </If.Then>
        <If.Else>
          <Sequence sap2010:WorkflowViewState.IdRef="Sequence_4">
            <p:GetDynamicValueProperty x:TypeArguments="x:String" sap2010:WorkflowViewState.IdRef="GetDynamicValueProperty`1_1" PropertyName="error/message/value">
              <p:GetDynamicValueProperty.Result>
                <OutArgument x:TypeArguments="x:String">
                  <mca:CSharpReference x:TypeArguments="x:String">errorMessage</mca:CSharpReference>
                </OutArgument>
              </p:GetDynamicValueProperty.Result>
              <p:GetDynamicValueProperty.Source>
                <InArgument x:TypeArguments="p:DynamicValue">
                  <mca:CSharpValue x:TypeArguments="p:DynamicValue">response</mca:CSharpValue>
                </InArgument>
              </p:GetDynamicValueProperty.Source>
            </p:GetDynamicValueProperty>
            <p1:AppOnlySequence DisplayName="Write to history">
              <p1:AppOnlySequence.Body>
                <p1:WriteToHistory sap2010:WorkflowViewState.IdRef="WriteToHistory_3">
                  <p1:WriteToHistory.Message>
                    <InArgument x:TypeArguments="x:String">
                      <mca:CSharpValue x:TypeArguments="x:String">"GetRoleDefinitionId Exception: " + errorMessage</mca:CSharpValue>
                    </InArgument>
                  </p1:WriteToHistory.Message>
                </p1:WriteToHistory>
              </p1:AppOnlySequence.Body>
              <sap2010:WorkflowViewState.IdRef>AppOnlySequence_4</sap2010:WorkflowViewState.IdRef>
            </p1:AppOnlySequence>
            <Throw sap2010:WorkflowViewState.IdRef="Throw_1">
              <InArgument x:TypeArguments="s:Exception">
                <mca:CSharpValue x:TypeArguments="s:Exception">new ArgumentException("GetRoleDefinitionId Exception: " + errorMessage)</mca:CSharpValue>
              </InArgument>
            </Throw>
          </Sequence>
        </If.Else>
      </If>
      <p1:AppOnlySequence DisplayName="Write to history">
        <p1:AppOnlySequence.Body>
          <p1:WriteToHistory sap2010:WorkflowViewState.IdRef="WriteToHistory_4">
            <p1:WriteToHistory.Message>
              <InArgument x:TypeArguments="x:String">
                <mca:CSharpValue x:TypeArguments="x:String">string.Format("GetRoleDefinitionId: RoleName={0}, DefenitionId={1}", RoleName, RoleDefinitionId)</mca:CSharpValue>
              </InArgument>
            </p1:WriteToHistory.Message>
          </p1:WriteToHistory>
        </p1:AppOnlySequence.Body>
        <sap2010:WorkflowViewState.IdRef>AppOnlySequence_5</sap2010:WorkflowViewState.IdRef>
      </p1:AppOnlySequence>
    </Sequence>
    <sads:DebugSymbol.Symbol>d5MBRDpcU2hhcmVQb2ludFByb2plY3RzXFNoYXJlUG9pbnRBcHBzXEhlbHBEZXNrXHRydW5rXEFydGV6aW8uU1AuSGVscERlc2tcQXJ0ZXppby5TUC5IZWxwRGVza1xBY3Rpdml0aWVzXEdldFJvbGVEZWZpbml0aW9uSWRcR2V0Um9sZURlZmluaXRpb25JZC54YW1sKTwDygEOAgEBQgVlCgIBYWYFyAEQAgECRQtFawIBYkkJYxQCAWlnB4UBHAIBRoYBB7sBDAIBDLwBB8cBHAIBA0oLTyACAXtQC1YXAgFzVwtiIAIBamkLgwEYAgFHiQENiQFlAgENjQELmAEnAgE2mwELuQEWAgEUvgELxAEfAgEETA9MhgECAXxTEVNdAgF0WQ9fIwIBa2wRcS8CAV57EXtkAgFXgAERgAGcAQIBUHYRdmUCAUlpS2lQAgFIkAERkAFmAgE/lQERlQFdAgE4jQGLAY0BkQECATecAQ2nASkCASaoAQ2zASICAR20AQ24ARUCARXBARHBAa8BAgEFTF1MgwECAX1cFVyOAQIBbG5LbmoCAWBvUW9wAgFfnwETnwFlAgEvpAETpAFfAgEonAGOAZwBowECASeqARGwASUCAR62ARG2AZkBAgEWrQEXrQGFAQIBHw==</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="WriteToHistory_1" sap:VirtualizedContainerService.HintSize="200,68" />
      <sap2010:ViewStateData Id="AppOnlySequence_2" sap:VirtualizedContainerService.HintSize="226,148">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WebUri_1" sap:VirtualizedContainerService.HintSize="226,68" />
      <sap2010:ViewStateData Id="WriteToHistory_2" sap:VirtualizedContainerService.HintSize="200,68" />
      <sap2010:ViewStateData Id="AppOnlySequence_3" sap:VirtualizedContainerService.HintSize="226,148">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Sequence_2" sap:VirtualizedContainerService.HintSize="248,568">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_1" sap:VirtualizedContainerService.HintSize="495,718">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="HttpSend_1" sap:VirtualizedContainerService.HintSize="200,62" />
      <sap2010:ViewStateData Id="AppOnlySequence_1" sap:VirtualizedContainerService.HintSize="473,148" />
      <sap2010:ViewStateData Id="GetDynamicValueProperty`1_2" sap:VirtualizedContainerService.HintSize="200,22" />
      <sap2010:ViewStateData Id="GetDynamicValueProperty`1_1" sap:VirtualizedContainerService.HintSize="226,22" />
      <sap2010:ViewStateData Id="WriteToHistory_3" sap:VirtualizedContainerService.HintSize="200,68" />
      <sap2010:ViewStateData Id="AppOnlySequence_4" sap:VirtualizedContainerService.HintSize="226,148">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Throw_1" sap:VirtualizedContainerService.HintSize="226,22" />
      <sap2010:ViewStateData Id="Sequence_4" sap:VirtualizedContainerService.HintSize="248,396">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_2" sap:VirtualizedContainerService.HintSize="473,546" />
      <sap2010:ViewStateData Id="WriteToHistory_4" sap:VirtualizedContainerService.HintSize="200,68" />
      <sap2010:ViewStateData Id="AppOnlySequence_5" sap:VirtualizedContainerService.HintSize="473,148">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Sequence_3" sap:VirtualizedContainerService.HintSize="495,1046">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="517,1928">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Artezio.SP.WorkflowActions.GetRoleDefinitionId_1" sap:VirtualizedContainerService.HintSize="557,2008" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>